package com.sleepcamel.resteasyConfigurator.components.wizard;

import org.eclipse.jface.wizard.Wizard;

import com.sleepcamel.resteasyConfigurator.components.wizard.pages.FirstPageView;
import com.sleepcamel.resteasyConfigurator.components.wizard.pages.SecondPageView;
import com.sleepcamel.resteasyConfigurator.model.App;
import com.sleepcamel.resteasyConfigurator.model.dbwizard.DBWizardModel;

public class DBConnectionWizard extends Wizard {

	private DBWizardModel dbwizard;

	public DBConnectionWizard(DBWizardModel dbwizard) {
		this.dbwizard = dbwizard;
		addPage(new FirstPageView(dbwizard.getFirstPage()));
		addPage(new SecondPageView(dbwizard.getSecondPage()));
		
	    // Set the dialog window title
	    setWindowTitle("DB Connection Wizard");
	}

	@Override
	public boolean canFinish() {
		return true;
	}
	
	@Override
	public boolean performFinish() {
		if ( canFinish() ){
			App.getInstance().loadProjectGeneratedFromDB();
		}
		return true;
	}

	
}
